#include <s32strm.h>
#include <qikon.hrh>

#include "PinQPreferences.h"

TPinQPreferences::TPinQPreferences() :
	iListViewZoomState(EQikCmdZoomLevel2),
	iTaskViewZoomState(EQikCmdZoomLevel2)
	{
	}

void TPinQPreferences::ExternalizeL(RWriteStream &aStream) const
	{
	aStream.WriteInt16L(iListViewZoomState);
	aStream.WriteInt16L(iTaskViewZoomState);
	const_cast<TPinQPreferences*>(this)->SetDirty(EFalse);
	}

void TPinQPreferences::InternalizeL(RReadStream &aStream)
	{
	SetListViewZoomState(aStream.ReadInt16L());
	SetTaskViewZoomState(aStream.ReadInt16L());
	}

TBool TPinQPreferences::IsDirty() const
	{
	return iDirty;
	}

void TPinQPreferences::SetDirty(TBool aDirty)
	{
	iDirty = aDirty; 
	}

TInt TPinQPreferences::ListViewZoomState() const
	{ 
	return iListViewZoomState; 
	}

TBool TPinQPreferences::SetListViewZoomState(TInt aZoomState)
	{
	ASSERT(Rng(EQikCmdZoomLevel1, aZoomState, EQikCmdZoomLevel3));	
	if (aZoomState == iListViewZoomState)
		{
		return EFalse;
		}
	iListViewZoomState = aZoomState;
	iDirty = ETrue;
	return ETrue;
	}

TInt TPinQPreferences::TaskViewZoomState() const
	{
	return iTaskViewZoomState;
	}

TBool TPinQPreferences::SetTaskViewZoomState(TInt aZoomState)
	{
	ASSERT(Rng(EQikCmdZoomLevel1, aZoomState, EQikCmdZoomLevel3));
	if (aZoomState == iTaskViewZoomState)
		{
		return EFalse;
		}
	iTaskViewZoomState = aZoomState;
	iDirty = ETrue;	
	return ETrue;
	}
